package com.basic.library.binding.command;


/**
 * About : kelin的ReplyCommand
 * 执行的命令回调, 用于ViewModel与xml之间的数据绑定
 */
public class BindingCommand<T> extends BindingCommandAbstract{
    public BindingCommand(BindingAction execute) {
        super(execute);
    }

    public BindingCommand(BindingConsumer<T> execute) {
        super(execute);
    }

    public BindingCommand(BindingConsumer<T> execute, BindingDisposable disposable) {
        super(execute, disposable);
    }

    public BindingCommand(BindingAction execute, BindingFunction canExecute0) {
        super(execute, canExecute0);
    }

    public BindingCommand(BindingConsumer<T> execute, BindingFunction canExecute0) {
        super(execute, canExecute0);
    }

    public BindingCommand(BindingConsumer<T> execute, BindingFunction canExecute0, BindingDisposable disposable) {
        super(execute, canExecute0, disposable);
    }

//    private BindingAction execute;
//    private BindingConsumer<T> consumer;
//    private BindingFunction<Boolean> canExecute0;
//    public BindingDisposable disposable;
//
//    public BindingCommand(BindingAction execute) {
//        this.execute = execute;
//    }
//
//    /**
//     * @param execute 带泛型参数的命令绑定
//     */
//    public BindingCommand(BindingConsumer<T> execute) {
//        this.consumer = execute;
//    }
//
//    public BindingCommand(BindingConsumer<T> execute, BindingDisposable disposable) {
//        this.consumer = execute;
//        this.disposable = disposable;
//    }
//
//    /**
//     * @param execute     触发命令
//     * @param canExecute0 true则执行,反之不执行
//     */
//    public BindingCommand(BindingAction execute, BindingFunction<Boolean> canExecute0) {
//        this.execute = execute;
//        this.canExecute0 = canExecute0;
//    }
//
//    /**
//     * @param execute     带泛型参数触发命令
//     * @param canExecute0 true则执行,反之不执行
//     */
//    public BindingCommand(BindingConsumer<T> execute, BindingFunction<Boolean> canExecute0) {
//        this.consumer = execute;
//        this.canExecute0 = canExecute0;
//    }
//
//    public BindingCommand(BindingConsumer<T> execute, BindingFunction<Boolean> canExecute0, BindingDisposable disposable) {
//        this.consumer = execute;
//        this.canExecute0 = canExecute0;
//        this.disposable = disposable;
//    }
//
//    /**
//     * 执行BindingAction命令
//     */
//    public void execute() {
//        if (execute != null && canExecute0()) {
//            execute.call();
//        }
//    }
//
//    /**
//     * 执行带泛型参数的命令
//     *
//     * @param parameter 泛型参数
//     */
//    public void execute(T parameter) {
//        if (consumer != null && canExecute0()) {
//            consumer.call(parameter);
//        }
//    }
//
//    /**
//     * 是否需要执行
//     *
//     * @return true则执行, 反之不执行
//     */
//    private boolean canExecute0() {
//        if (canExecute0 == null) {
//            return true;
//        }
//        return canExecute0.call();
//    }
}
